<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        FileUpload <span class="subitem">Basic</span>
    </ui:define>

    <ui:define name="description">
        Simple uploader uses native browser file upload. Simple uploader is disabled at online demo.
    </ui:define>

    <ui:param name="documentationLink" value="/components/fileupload"/>
    <ui:param name="widgetLink" value="FileUpload-1"/>

    <ui:define name="implementation">

        <p:growl id="messages" showDetail="true"/>

        <div class="card">
            <h5>Single</h5>
            <h:form enctype="multipart/form-data">
                <p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true"/>

                <p:commandButton value="Submit" ajax="false" action="#{fileUploadView.upload}" styleClass="mt-3 ui-button-outlined block"/>
            </h:form>
        </div>

        <div class="card">
            <h5>Single (allowTypes validation)</h5>
            <h:form enctype="multipart/form-data">
                <p:fileUpload value="#{fileUploadView.file}" mode="simple" skinSimple="true">
                    <p:validateFile allowTypes="/(\.|\/)(pdf)$/" />
                </p:fileUpload>

                <p:commandButton value="Submit" action="#{fileUploadView.upload}" styleClass="mt-3 ui-button-outlined block"
                                 validateClient="false" process="@form" update="messages"/>

                <p:commandButton value="Submit (+ validateClient)" action="#{fileUploadView.upload}" styleClass="mt-3 ui-button-outlined block"
                                 validateClient="true" process="@form" update="messages"/>
            </h:form>
        </div>

        <div class="card">
            <h5>Multiple</h5>
            <h:form enctype="multipart/form-data">
                <p:fileUpload value="#{fileUploadView.files}" mode="simple" skinSimple="true" multiple="true"/>
                <p:commandButton value="Submit" ajax="false" action="#{fileUploadView.uploadMultiple}" styleClass="mt-3 ui-button-outlined block"/>
            </h:form>
        </div>

    </ui:define>

</ui:composition>
